<!DOCTYPE html>
<html>
<#include "../../common/header.ftl">
<script src="${basePath}/js/topic/list.js?v=201711021700"></script>

<head>
<meta charset="UTF-8">
<title>话题管理</title>
<style>
	.left{
		float:left;
		min-width:100px;
		margin-left: 10px;
	}
	.table-margin{
		margin:5px 3%;
		width:92%;
	}
</style>

</head>
<body>
   
<div class="container" style="margin-left:5%;width:90%">
	<form class="layui-form left" action="#" >
		<div class="layui-form-item ">
		    <label class="layui-form-label left">是否审核</label>
		    <div class="layui-input-block left">
		      <select name="isChecked" >
		        <option value="">所有</option>
		        <option value="">所有</option>
		        <option value="-1" <#if param.isChecked?? && (param.isChecked==-1)> selected</#if>>已拒绝</option>
		        <option value="0" <#if param.isChecked?? && (param.isChecked== 0)> selected</#if>>待审核</option>
		        <option value="1" <#if param.isChecked?? && (param.isChecked== 1)> selected</#if>>已审核</option>
		      </select>
		    </div>
		    <div class="layui-input-block left">
		      <input type="text" name="keyword" value="${param.keyword!}"   placeholder="标题/标签"  
		      class="layui-input" style="width:400px;margin-right:200px;margin-left:30px">
		    </div>
		     <div class="layui-input-block left">
		      <button type="button" class="layui-btn"  id="search-button">搜索</button>
		       <#if permission?? && (permission.P1803??)>
			      <button type="button" class="layui-btn layui-btn-normal" id="addTopic-button">新增话题</button>
		       </#if>
		    </div>
		</div>
	</form>
</div>
<table class="table table-margin">
  <thead>
      <tr>
         <th>标题</th>
         <th>封面图</th>
         <th>标签</th>
         <th>点击量</th>
         <th>是否审核</th>
         <th>创建人</th>
         <th>创建时间</th>
         <th>操作</th>
      </tr>
  </thead>
  <tbody>
	<#list page.itemList! as topic>
		<tr>
			<td>${topic.title!}</td>
			<td>
			<#if topic.coverImage??>
				<img  src="${imgUrl+topic.coverImage}" height="50px" width="50px" 
				 data-toggle="modal" data-target="#imgModal" onerror="this.src='${basePath}/images/default_goods.jpg'" />
			<#else>
				<img  src="${basePath}/images/default_goods.jpg" height="50px" width="50px"  data-toggle="modal" data-target="#imgModal"/> 
			</#if>
			</td>
			<td>${topic.tag!}</td>
			<td>${topic.clickQuantity!}</td>
			<td><#if topic.checkStatus?? && topic.checkStatus == -1>已拒绝
				<#elseif topic.checkStatus?? && topic.checkStatus == 0>待审核
				<#elseif topic.checkStatus?? && topic.checkStatus == 1>已审批
				<#else>状态异常</#if>
			</td>
			<td>${topic.creatorName!}</td>
			<td>${topic.createTime?string("yyyy-MM-dd HH:mm")}</td>
			<td >
			<div class="btn-group ">
			  <button type="button" class="btn btn-primary dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
			    	操作<span class="caret"></span>
			  </button>
			  <ul class="dropdown-menu">
			   <#if permission?? && (permission.P1804??)>
			    	<li><a href="#" onclick="editFun('${topic.id}')">修改话题</a></li>
			   </#if>
			    <#if permission?? && (permission.P1806??)>
			    	<li><a href="#" onclick="deleteFun('${topic.id}')">删除话题</a></li>
			    </#if>
			     <#if permission?? && (permission.P1807??)>
				    <#if topic.checkStatus?? && topic.checkStatus == 0>
				    <li><a href="#" onclick="checkFun('${topic.id}','1')">审核通过</a></li>
				    <li><a href="#" onclick="checkFun('${topic.id}','-1')">审核拒绝</a></li>
				    </#if>
			     </#if>
			  </ul>
			</div>
			</td>
		</tr>
	</#list>
  </tbody>
</table>
	<#-- 翻页模块代码 -->
	<ul class="pager">
		<li><a href="javascript:void(0);" onclick="fanye('1')">首页</a></li>
		<#if (page.pageNo>1) > 
		<li><a	href="javascript:void(0);" onclick="fanye('${page.prevPage}')">上一页</a></li>
		<#else>
		<li><a href="javascript:void(0);">上一页</a></li> 
		</#if>
		<li><a href="javascript:void(0);">第${page.pageNo}页/共${page.totalPage}页</a></li>
		<#if (page.nextPage>page.pageNo) >
		<li><a href="javascript:void(0);" onclick="fanye('${page.nextPage}')">下一页</a></li>
		<#else>
		<li><a href="javascript:void(0);">下一页</a></li>
		</#if>
		<li><a href="javascript:void(0);" onclick="fanye('${page.totalPage}')">尾页</a></li>
	</ul>
  
</body>
<script type="text/javascript">
	var basePath="${basePath}";
	var init={
		isChecked:"${param.isChecked!}",
		keyword:"${param.keyword!}"
	}
	$(function(){
		layui.use(['form', 'layer'] , function(){
		  var layer = layui.layer;
		  var form = layui.form(); 
	});
});
</script>
</html>